import { defineStore } from "pinia";
import { ref, reactive } from 'vue'

export const useAiResultStore = defineStore('airesult', () => {
  // ai规划结果
  const aiPlanResult = ref()
  // 所有行程
  const travelList = reactive([])
  // 修改结果
  const changeAiPlanResult = (content) => {
    aiPlanResult.value = content
  }
  // 获取结果
  const getAiPlanResult = () => {
    return aiPlanResult.value
  }
  // 将行程添加到行程列表
  const addTravel = (travel) => {
    travelList.push(travel)
  }
  // 删除行程
  const deleteTravel = (index) => {
    travelList.splice(index, 1)
  }
  // 获取我的行程
  const getMyTravel = () => {
    return travelList
  }
  return {
    travelList,
    aiPlanResult,
    changeAiPlanResult,
    getAiPlanResult,
    addTravel,
    deleteTravel,
    getMyTravel
  }
})